﻿<Page x:Class="WpfMedia.MediaElementSample"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="296" d:DesignWidth="728" Title="MediaElementSample">
    <Grid>
        <Grid.Triggers>
            <EventTrigger  RoutedEvent="Button.Click" SourceName="button1">
                <EventTrigger.Actions>
                    <BeginStoryboard x:Name="beginStoryBorder">
                        <Storyboard>
                            <MediaTimeline Source="w.wmv"  Storyboard.TargetName="mediaElement1"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger.Actions>
            </EventTrigger>
            <EventTrigger  RoutedEvent="Button.Click" SourceName="button2">
                <EventTrigger.Actions>
                    <PauseStoryboard BeginStoryboardName="beginStoryBorder" />
                </EventTrigger.Actions>
            </EventTrigger>
            <EventTrigger  RoutedEvent="Button.Click" SourceName="button3">
                <EventTrigger.Actions>
                    <ResumeStoryboard BeginStoryboardName="beginStoryBorder" />
                </EventTrigger.Actions>
            </EventTrigger>
        </Grid.Triggers>
        <MediaElement Height="143" HorizontalAlignment="Left" Margin="33,12,0,0"  Name="mediaElement1" VerticalAlignment="Top" Width="482" />
        <Button Content="Play" Height="23" HorizontalAlignment="Left" Margin="58,178,0,0" Name="button1" VerticalAlignment="Top" Width="75" >
        </Button>
        <Button Content="Pause" Height="23" HorizontalAlignment="Left" Margin="202,178,0,0" Name="button2" VerticalAlignment="Top" Width="75" >
        </Button>

        <Button Content="Resume" Height="23" HorizontalAlignment="Left" Margin="337,178,0,0" Name="button3" VerticalAlignment="Top" Width="75" >
        </Button>
    </Grid>
</Page>
